package com.zq.springcloud.controller;

import com.zq.springcloud.entity.Emp;
import com.zq.springcloud.service.IEmpClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ================================================
 * 作    者：程志强
 * 邮    箱：cheng.zhiqiang@cesgroup.com.cn
 * 版    本：1.0.0
 * 创建日期：2021/1/5 15:57
 * 修改日期：
 * 描    述：消费者controller--feign
 * 修订历史：
 * ================================================
 */

@RestController
public class EmpConsumerFeignController {

    // 由原来的RestTemplate 换成 Feign
    @Autowired
    private IEmpClientService empClientService;

    @GetMapping("/provider/query-one/{empId}")
    public Emp getOne(@PathVariable("empId") long empId) {
        return empClientService.queryById(empId);
    }


    @GetMapping("/provider/query")
    public List<Emp> getAll() {
        return empClientService.queryAll();
    }
}
